//
//  PropertyRentDetailInfoTableViewCell.m
//  PropertyManager
//
//  Created by TNG on 2018/7/17.
//  Copyright © 2018年 Tng. All rights reserved.
//

#import "PropertyRentDetailInfoTableViewCell.h"

@implementation PropertyRentDetailInfoTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self creatUI];
    }
    return self;
}

-(void)creatUI{
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.detailLabel];
//    [self.contentView addSubview:self.moneyLabel];
}

-(void)send
{
    self.titleLabel.text = @"我是标题七个字";
    self.detailLabel.text = @"㎡｜广州 天河区 车陂｜办公";
    self.moneyLabel.text = @"￥4000/月";
}

-(void)sendRentModel:(RentModel *)model
{
//    self.moneyLabel.frame = CGRectMake(WIDTH - 25 - model.monyeWidth, 15, model.monyeWidth+10, 20);
    self.titleLabel.frame = CGRectMake(15, 15, WIDTH - 30, model.titleHeight);
    self.detailLabel.frame = CGRectMake(15, 25+model.titleHeight, WIDTH - 30, model.detailHeight+5);
    self.titleLabel.text = model.title;
    NSMutableString * str = [NSMutableString string];
    if (![[NSString stringWithFormat:@"%@",model.housesize] isEqualToString:@""]) {
        [str appendString:[NSString stringWithFormat:@"%@p㎡ ",[NSString stringWithFormat:@"%@",model.housesize]]];
    }
    if (![model.estate isEqualToString:@""]) {
        [str appendString:[NSString stringWithFormat:@"%@ ",model.estate]];
    }
    if (![model.livec isEqualToString:@""]) {
        [str appendString:[NSString stringWithFormat:@"%@",model.livec]];
    }
    self.detailLabel.text = str;
//    self.moneyLabel.text = [NSString stringWithFormat:@"￥%@/月",model.price];
}

-(UILabel *)titleLabel
{
    if (_titleLabel == nil) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.font = font(16);
        _titleLabel.textColor = SFM51;
        _titleLabel.numberOfLines = 0;
        _titleLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _titleLabel;
}

-(UILabel *)detailLabel
{
    if (_detailLabel == nil) {
        _detailLabel = [[UILabel alloc] init];
        _detailLabel.font = font(14);
        _detailLabel.textColor = SFM153;
        _detailLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _detailLabel;
}

-(UILabel *)moneyLabel
{
    if (_moneyLabel == nil) {
        _moneyLabel = [[UILabel alloc] init];
        _moneyLabel.font = font(16);
        _moneyLabel.textColor = SFMColor(254, 39.8, 39.8);
        _moneyLabel.textAlignment = NSTextAlignmentRight;
    }
    return _moneyLabel;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
